package top.haijunit.work.modules.core;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author zhanghaijun
 * @date 2024/8/17 09:33
 * @description [一句话描述该类的功能]
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseEntity implements java.io.Serializable {

    /**
     * 数据库自增主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 唯一主键
     */
    @TableField(fill = FieldFill.INSERT)
    private Long uniqCode;

    /**
     * 创建人
     */
    @TableField(fill = FieldFill.INSERT)
    private Long createBy;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 更新人
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateBy;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    /**
     * 是否删除, 0未删除 1已删除
     */
    @TableLogic
    private Integer deleted;

    public boolean allowInputCode() {
        return false;
    }
}
